        <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>/public/assets/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>/public/assets/css/lesson.css">
        
        <link href="<?php echo base_url()?>/public/assets/css/star-rating.css" media="all" rel="stylesheet" type="text/css"/>
        <script src="<?php echo base_url()?>/public/assets/js/star-rating.js" type="text/javascript"></script>
        <style>
        .click{width:96%;padding:2% 0;margin:2% auto;border-top:1px dotted #E5E5E5}
        .weui_cells_title{margin-top:.3em}
        </style>
        <div class="weui_navbar">
            <div class="weui_navbar_item <?php if(empty($type) || $type == 0 )echo 'weui_bar_item_on'?>" onclick="tiaozhuan(0);">
                全部
            </div>
            <div class="weui_navbar_item <?php if($type == 1)echo 'weui_bar_item_on'?>" onclick="tiaozhuan(1);">
                等待上课
            </div>
            <div class="weui_navbar_item <?php if($type == 2)echo 'weui_bar_item_on'?>" onclick="tiaozhuan(2);">
                已下课
            </div>
        </div>
        
        <ul style="display: block;">
        <?php if($book_list){?>
        <?php foreach ($book_list as $val){?>
            <li>
                <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg">
                    <div class="weui_media_hd">
                        <img class="weui_media_appmsg_thumb" src="<?php echo $val['book_logo']?>" alt="">
                    </div>
                    <div class="weui_media_bd">
                        <h4 class="weui_media_title"><?php echo $val['book_title']?>
                         <?php if($val['status'] == 0){?>
                         <em class="wait">等待上课</em>
                         <?php }elseif ($val['status'] == 1 || $val['status'] == 6){?>
                         <em class="wait">上课中</em>
                         <?php }elseif ( ($val['status'] == 2 || $val['status'] == 5) && $val['evaluate'] == 0){?>
                         <em class="already">已下课，待评价</em>
                         <?php }elseif ($val['status'] == 2 || $val['status'] == 5){?>
                         <em class="done">已下课</em>
                         <?php }elseif ($val['status'] == 3){?>
                         <em class="done">已结束</em>
                         <?php }?>
                        </h4>
                    </div>
                </a>
                <a class="weui_cell" href="javascript:void(0);">
                    <div class="weui_cell_hd"><img src="<?php echo $val['teacher_avatar']?>" alt="" style="width:40px;margin-right:5px;display:block"></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <p><?php echo $val['teacher_name']?></p>
                    </div>
                    <span class="weui_cell_ft"></span>
                </a>
                <div class="weui_media_box weui_media_text">
                    <p class="weui_media_desc"><?php echo $val['book_date']?>（<?php echo $weekArr[date('w',strtotime($val['book_date']))]?>）<?php echo $val['book_date_start']?></p>
                    <p class="weui_media_desc"><?php echo $val['address']?></p>
                </div>
                <div class="click">
                <?php if($val['status'] == 1 || $val['status'] == 6){?>
                <a href="javascript:classover(<?php echo $val['book_id']?>);" class="weui_btn weui_btn_mini weui_btn_default classover">确认下课</a>
                <?php }?>
                <?php if($val['status'] == 0){?>
                <a href="javascript:classcancel(<?php echo $val['book_id']?>);" class="weui_btn weui_btn_mini weui_btn_default cancle">取消预约</a>
                <a href="/courserecord/resetbook?book_id=<?php echo $val['book_id']?>" class="weui_btn weui_btn_mini weui_btn_default cancle">转单</a>
                <?php }?>
                <?php if( ($val['status'] == 2 || $val['status'] == 5) && $val['evaluate'] == 0){?>
                <a href="javascript:evaluate(<?php echo $val['book_id']?>);" class="weui_btn weui_btn_mini weui_btn_default cancle">评价</a>
                <?php }?>                
                <a href="/courserecord/courseinfo?book_id=<?php echo $val['book_id']?>" class="weui_btn weui_btn_mini weui_btn_default detial">查看详情</a>
                </div>
            </li>
        <?php }?>    
        <?php }else{?>
        <li>
            <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg">
                <p style="margin-left: 35%;">没有约课记录</p>
            </a>
        </li>
        <?php }?>
        </ul>

        <!--确认下课-->
        <!--确认取消-->
        <div class="weui_dialog_confirm" id="dialog1" style="display: none;">
            <div class="weui_mask"></div>
            <div class="weui_dialog">
                <div class="weui_dialog_hd"><strong id='dialog1_content' class="weui_dialog_title"></strong></div>
                <div class="weui_dialog_ft">
                    <a href="javascript:$('#dialog1').hide();" class="weui_btn_dialog default">取消</a>
                    <a href="javascript:;" id="dialog1_a" class="weui_btn_dialog primary">确定</a>
                </div>
            </div>
        </div>
        <!--评价弹窗-->
        <div class="weui_dialog_confirm" style="display:none;">
            <div class="weui_mask"></div>
            <div class="weui_dialog">
                <div class="weui_cells_title constar">
                    <input id="input-id" type="number" class="rating" min=0 max=5 step=1 data-size="lg" >
                </div>
            
                <div class="weui_cells weui_cells_form">
                    <div class="weui_cell">
                        <div class="weui_cell_bd weui_cell_primary">
                            <textarea class="weui_textarea" id="nr" placeholder="请输入评论" rows="3" onkeyup="tjzs()"></textarea>
                            <div class="weui_textarea_counter"><span id="evaluate_num">0</span>/100</div>
                        </div>
                    </div>
                </div>
                <div class="weui_dialog_ft">
                    <input type="hidden" value="0" name="book_id" />
                    <a href="javascript:$('.weui_dialog_confirm').hide();" class="weui_btn_dialog default">取消</a>
                    <a href="javascript:;" class="weui_btn_dialog primary" id="queding">确定</a>
                </div>
            </div>
        </div>
    <script type="text/javascript">
        $(document).ready(function(){        	
            $(".weui_navbar_item").bind("click",function(){
                var _index = $(this).index();
                var _ul =$("ul").get(_index);
                var path_a = $(".weui_navbar_item");
                path_a.not($(this).addClass("weui_bar_item_on")).removeClass("weui_bar_item_on");
                var path_b = $("ul");
                path_b.not($(_ul).show()).hide();
            });
//             $(".constar .fa").bind("click",function(){
//                 $(this).removeClass("fa-star-o");
//             });
//             var flag = 0;
//             $(".constar .fa").bind("click",function(){
//                 if(flag == 0){
//                     $(this).removeClass("fa-star-o");
//                     flag = 1;
//                 }
//                 else{
//                     $(this).addClass("fa-star-o");
//                     flag = 0;
//                 }
//             });
            //提交评价
            $("#queding").bind("click",function(){
                var $content = $('.weui_textarea').val();
                var $book_id = $("[name='book_id']").val();
                if(typeof($content) == "undefined" || $content == ''){
                    alert('请输入评语');
                    return false;
                }
                var $input_id = $('#input-id').val();
                if(typeof($input_id) == "undefined" || $input_id == '' || $input_id == 0){
                    alert('请输入评分');
                    return false;
                }
                //alert($input_id);
                window.location.href="/courserecord/evaluate?book_id="+$book_id+"&message="+$content+'&star='+$input_id;
            });

            var Height =parseInt($("ul").height());
            var Height = (Height + 41) + 'px';
            $("#event_ground").css("height",Height);
        });
        //取消预约
        function classcancel(book_id){
            $('#dialog1_content').html('确定取消预约吗？');
            $('#dialog1_a').attr('href','/courserecord/classcancel?book_id='+book_id);
            $('#dialog1').show();
        }
        //下课
        function classover(book_id){
            $('#dialog1_content').html('已经上完课了吗？');
            $('#dialog1_a').attr('href','/courserecord/classover?book_id='+book_id);
            $('#dialog1').show();
        }
        //评价
        function evaluate(book_id){
//             $('#dialog1_content').html('已经上完课了吗？');
//             $('#dialog1_a').attr('href','/courserecord/classover?book_id='+book_id);
        	$("[name='book_id']").val(book_id);
            $('.weui_dialog_confirm').show();
        }
        //跳转
        function tiaozhuan(type){
        	window.location.href="/courserecord/?type="+type;
        }
        function tjzs(){
            var evaluate_num = 100;//字数限制
        	var count = $("#nr").val().length; 
        	if(count > evaluate_num){ 
        	var nr = $("#nr").val().substring(0,evaluate_num); 
            	$("#nr").val(nr); 
            	count = evaluate_num; 
        	} 
        	$("#evaluate_num").html(count); 
        }

    </script>
